package com.xfb.user.config;

//import com.zaxxer.hikari.HikariDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

//@Configuration
public class DataSourceConfig {

    //@Value("${mysql.driverClassName}")
    /*String className = "com.mysql.cj.jdbc.Driver";

    //@Value("${mysql.url}")
    String mysqlUrl = "jdbc:mysql://localhost:3306/lagou?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false&serverTimezone=UTC";

    //@Value("${mysql.name}")
    String name = "root";

    //@Value("${mysql.password}")
    String password = "root";

    //@Bean
    public DataSource getDataSource() {
        HikariDataSource dataSource = new HikariDataSource();
        dataSource.setDriverClassName(className);
        dataSource.setJdbcUrl(mysqlUrl);
        dataSource.setUsername(name);
        dataSource.setPassword(password);
        return dataSource;
        *//*DataSourceBuilder<?> dataSourceBuilder = DataSourceBuilder.create();
        dataSourceBuilder.driverClassName(className);
        dataSourceBuilder.url(mysqlUrl);
        dataSourceBuilder.username(name);
        dataSourceBuilder.password(password);
        DataSource build = dataSourceBuilder.build();
        return build;*//*
    }*/

}
